﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="<%=basePath%>/page/lib/html5shiv.js"></script>
<script type="text/javascript" src="<%=basePath%>/page/lib/respond.min.js"></script>
<![endif]-->
<link href="<%=basePath%>/page/static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>/page/static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>/page/static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>/page/lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />
<style type="text/css">
	body{
		-moz-user-select: none; /*火狐*/ /*禁止用户在页面选择文字*/
		-webkit-user-select: none; /*webkit浏览器*/
		-ms-user-select: none; /*IE10*/
		-khtml-user-select: none; /*早期浏览器*/
		user-select: none;
	}
	.input-val{
		margin-right:12px;
		margin-left:-7px;
		float:left;
		width: 230px;
		background: #ffffff;
		height: 2.5rem;
		padding: 0 2%;
		border-radius: 0px;
		border: none;
		border: 1px solid rgba(0,0,0,.2);
		font-size: 1.0025rem;
	}
	#canvas{
		float:left;
		display: inline-block;
		border:1px solid #ccc;
		border-radius: 5px;
		cursor: pointer;
	}
	label.error {
    position: absolute;
    right: 284px;
    top: 8px;
    color: #ef392b;
    font-size: 16px;
}
</style>
<!--[if IE 6]>
<script type="text/javascript" src="<%=basePath%>/page/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>课程管理后台登录 </title>
<meta name="keywords" content="H-ui.admin v3.1,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v3.1，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<input type="hidden" id="TenantId" name="TenantId" value="" />
<div class="header"></div>
<div class="loginWraper">
  <div class="loginBox">
    <form class="form form-horizontal" id="student-login">
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
        <div class="formControls col-xs-8">
          <input id="studentName" name="studentName" type="text" placeholder="账户" class="input-text size-L">
        </div>
      </div>
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
        <div class="formControls col-xs-8">
          <input id="studentContact" name="studentContact" type="password" placeholder="密码" class="input-text size-L">
        </div>
      </div>
      <div>
        <div class="formControls col-xs-8 col-xs-offset-3">
          <input type="text" value="" placeholder="请输入验证码（不区分大小写）" class="input-val" />
          <canvas id="canvas" width="100" height="38"></canvas>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <label for="online">
            <input type="checkbox" name="online" id="online" value="">
            使我保持登录状态</label>
        </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <input name="" type="button" id="login-btn" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
          <input name="" type="button" id="register-btn" class="btn btn-default radius size-L" value="&nbsp;注&nbsp;&nbsp;&nbsp;&nbsp;册&nbsp;">
        </div>
      </div>
    </form>
  </div>
</div>
<script type="text/javascript" src="<%=basePath%>/page/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>/page/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="<%=basePath%>/page/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="<%=basePath%>/page/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="<%=basePath%>/page/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="<%=basePath%>/page/lib/security.code.js"></script>
<script type="text/javascript" src="<%=basePath%>/page/lib/layer/2.4/layer.js"></script>

<script type="text/javascript">
$(function(){
	
	var show_num = [];
	draw(show_num);
	$("#canvas").on('click',function(){
		draw(show_num);
	})
	
	
	$("#student-login").validate({
		rules:{
			studentName:{
				required:true,
			},
			studentContact:{
				required:true,
				digits:true
			},
			securityCode:{
				required:true,
			}
		},
		messages:{
			studentName:{
				required:"用户名不能为空！",
			},
			studentContact:{
				required:"密码不能为空！",
				digits:"密码只能是纯数字"
			},
			securityCode:{
				required:"验证码不为空！",
			}
			
		},
		errorElement: "label", //用来创建错误提示信息标签,validate插件默认的就是label
		success: function(label) { //验证成功后的执行的回调函数
			$("#login-btn").on('click',function(){
				var val = $(".input-val").val().toLowerCase();
				var num = show_num.join("");
				if(val==''){
					layer.msg('请输入验证码!',{icon: 2,time:1000});
				}else if(val == num){
					$.ajax({
						url:"${pageContext.request.contextPath}/student/studentLogin",
						data:{
							"studentName":$("#studentName").val(),
							"studentContact":$("#studentContact").val()
						},
						type:"post",
						success:function(msg){
							if(msg=="success"){
								location.href = "${pageContext.request.contextPath}/student/index";
							}else{
								layer.msg('用户名或密码错误!',{icon: 2,time:1000});

							}
							$(".input-val").val('');
							draw(show_num);
						},
						error:function(msg){
							$(".input-val").val('');
							draw(show_num);
						}
					})
				}else{
					layer.msg('验证码输入错误!',{icon: 2,time:1000});
					$(".input-val").val('');
					draw(show_num);
				}
			})
		}
	});
	
	$("#register-btn").click(function(){
		location.href = "<%=basePath%>/student/register";
	})
});

</script>
</body>
</html>